package com.wfs.spring.aop;

import com.wfs.spring.service.TestThreeService;
import org.aspectj.lang.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

@Aspect
public class Audience {
    @Autowired
    TestThreeService testThreeService;
    //@Pointcut("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    //@Before("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    public void before(){
    }
    // @Before("execution(* com.wfs.spring.service.impl.aop.TestAopServiceImpl.*(..))")
   // @Before("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    public void before2(){
        System.out.println("before2");
    }
    //@After("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    public void after(){
        System.out.println("after");
    }

    //@AfterReturning("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    public void afterReturning(){
        System.out.println("afterReturning");
    }
    //@AfterThrowing("execution(* com.wfs.spring.service.aop.TestAopService.*(..))")
    public void afterThrowing(){
        System.out.println("afterThrowing");
    }



   @Around("execution(* com.wfs.spring.service.aop.TestAopService.*(String))"+"&& args(name)")
    public void around(String name ){
       System.out.println("参数name:"+name);
        System.out.println("around ");
       testThreeService.test3();
    }

}
